using UnityEngine;

namespace skeleton
{
    public class IdleState : State
    {
        [SerializeField] float duratoin;

        float timer;

        // ========================================================================

        public override void Enter()
        {
            base.Enter();

            timer = duratoin;
            skeleton.ResetVelocity();
        }

        public override void Process()
        {
            base.Process();

            if (skeleton.TryChangeState(StateCode.Chase)) return;

            timer -= Time.deltaTime;
            if (timer < 0)
                skeleton.ChangeState(StateCode.Walk);
        }
    }
}
